package com.webbei.myCustom.action;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class MyUtil {
	public static void copy(String from, String toPath) {
		try {
			FileInputStream fis = new FileInputStream(from);
			String filename = from.split("/")[from.split("/").length - 1];
			FileOutputStream fos = new FileOutputStream(toPath + filename);
			byte[] b = new byte[1024];
			int count;
			while ((count = fis.read(b, 0, b.length)) != -1) {
				fos.write(b, 0, count);
			}
			fis.close();
			fos.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
